package com.chenjie.executor.day13;


/**
 * packageName com.chenjie.executor.day09
 *
 * @author chenjie
 * @version JDK 8
 * @className Main1 (此处以class为例)
 * @date 2024/5/27
 * @description TODO
 */
public class Main4 {

    /**
     * 查询线程组信息
     * @param args
     */
    public static void main(String[] args) {
        ThreadGroup group = new ThreadGroup("人人都是程序员");
        System.out.println("线程组的名称"+group.getName());
        System.out.println("线程组的最大优先级"+group.getMaxPriority());
        //设置线程组的最大优先
        group.setMaxPriority(1);
        System.out.println("修改后线程组的最大优先级"+group.getMaxPriority());

        Thread thread=new Thread(group,"线程");
        thread.start();
        System.out.println("线程组存货的线程数量"+group.activeCount());
        //中断线程组中所有的线程
        group.interrupt();
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程组存货的线程数量"+group.activeCount());

    }
}
